<template>
  <div>
    <el-card shadow="never" class="mb20">
      <comment-form @search="handleSearch" ref="commentForm" />
    </el-card>
    <el-card shadow="never">
      <el-tooltip class="item" content="新增评语模板" effect="dark" placement="top">
        <el-button
          size="small"
          class="fr mb20"
          type="primary"
          @click="handleEdit(false, {})"
          icon="el-icon-plus"
        />
      </el-tooltip>
      <comment-table @edit="handleEdit" ref="commentTable" />
    </el-card>
    <comment-modal @refresh="handleSearch" ref="commentModal" />
  </div>
</template>

<script>
import CommentForm from './CommentForm'
import CommentTable from './CommentTable'
import CommentModal from './CommentModal'
export default {
  components: {
    CommentTable,
    CommentForm,
    CommentModal
  },
  methods: {
    handleSearch(obj = {}) {
      this.$refs.commentTable.handleGetList(obj)
    },
    handleEdit(bool, obj) {
      this.$refs.commentModal.edit(bool, obj)
    }
  }
}
</script>
